// Test behaviour of the ADTS.

#include <cstdio>
#include "util/re.hpp"

using namespace Ripe;
using std::printf;

void report(bool match, int id, int len)
{
  if (match){
    printf("succesful match: %d of len = %d\n", id, len);
  } else {
    printf("no match\n");
  }
}

int main()
{
  try {
    NFANode* nfa = re_compile("(a*)", 0);
    int id, len; bool match;
    match = re_match("aaaa", nfa, true, &id, &len);
    report(match, id, len);
    match = re_match("aaaa", nfa, false, &id, &len);
    report(match, id, len);
    
    nfa_destroy(nfa);
  } catch (Exception e) {
    printf("Error: %s\n", e.what());
  }
  return 0;
}
